<template>
    <div >
    <h2>{{news.title}}</h2>
    <!-- v-html 格式解析 -->
    <div v-html="news.content"></div>
    </div>
</template>

<script>
export default {
    data(){
        return{
            msg:'我想获得路由的传值',
            news:[]
        }
    },
       methods:{
        requestNewsContent(aid){
        let api = 'http://www.phonegap100.com/appapi.php?a=getPortalArticle&aid='+aid;
        this.$http.get(api).then((response)=>{
           console.log(response);
           this.news = response.body.result[0];
        },(erro)=>{
        console.log(erro);
        });

        }
    },
    mounted(){
        // 获得动态路由传值
        console.log(this.$route.params.aid);
        let aid = this.$route.params.aid;
        if(aid)
        {
         this.requestNewsContent(aid);
        }
        
    }
}
</script>

<style lang="sass" scoped>

</style>
